package com.yilin.tms.core.entity.truck;


import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yilin.tms.core.commons.base.BaseDataEntity;
import com.yilin.tms.core.entity.gps.VehicleGps;
import com.yilin.tms.core.entity.order.party.OrderAppraise;
import com.yilin.tms.core.entity.user.organize.Organize;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;


/**
 * 车源实体类
 *
 * @author zhangjinyuan
 * @date 2022/10/24
 */
@Entity
@Table(name = "truck_source")
@TableName(value = "truck_source")
public class TruckSource extends BaseDataEntity {

    /**
     * 车源状态
     */
    public enum SourceStatus {
        save(0, "已保存","车源已保存，可随时完成上线"),
        release(1, "已上线","车源已上线，随时接收货源通知"),
        scrap(2, "作废（回收站）","车源已作废，您可以重新编辑发布");
        @EnumValue
        public Integer index;
        public String name;
        public String remark;
        SourceStatus(Integer index, String name,String remark) {
            this.index = index;
            this.name = name;
            this.remark = remark;
        }
    }

    @Column(name = "vehicle_id")
    private String vehicleId; //车
    @Column(name = "track_no")
    private String trackNo; //车牌号
    @Column(name = "remarks", columnDefinition = "TEXT")
    private String remarks;//备注
    @Column(name = "source_status", columnDefinition = "TEXT")
    private SourceStatus sourceStatus;//车源状态
    @Column(name = "release_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date releaseTime = new Date();//发布时间
    @Column(name = "end_time")//todo
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date endTime; //截止时间 自动下线 为空不限
    /**
     * 车主(组织)信息
     */
    @Column(name = "organize_id")
    private String organizeId;
    @Column(name = "organize_name")
    private String organizeName;
    @Column(name = "organize_logo")
    private String organizeLogo;
    @Column(name = "organize_monthly_rating")
    private Double organizeMonthlyRating;
    @Column(name = "organize_member_type_name")
    private String organizeMemberTypeName;
    @Column(name = "manage_user_id")
    private String manageUserId;//管理员
    /**
     * 接单意向
     * */
    @Column(name = "intent_deliver_area", columnDefinition = "TEXT")
    private String intentDeliverArea;//意向起始区域，“,号隔开”
    @Column(name = "intent_receive_area", columnDefinition = "TEXT")
    private String intentReceiveArea;//意向收货区域，“,号隔开”
    @Column(name = "intent_goods_type", columnDefinition = "TEXT")
    private String intentGoodsType;//意向收货区域，“,号隔开”


    /**
     * 车辆显示数据
     * 跟隨車輛
     */
    @Transient
    @TableField(exist = false)
    private String commTruckTypeId;//公共车辆类型ID
    @Transient
    @TableField(exist = false)
    private String commTruckTypeName;//公共车辆类型 @Transient
    @Transient
    @TableField(exist = false)
    private String truckTypeName;//车辆类型Name
    @Transient
    @TableField(exist = false)
    private String cardPlateName;//车牌颜色
    @Transient
    @TableField(exist = false)
    private TruckVehicle.TruckStatus truckStatus;//车辆状态
    @Transient
    @TableField(exist = false)
    private Double vehicleLong; //车长
    @Transient
    @TableField(exist = false)
    private Double vehicleHeight;//车高
    @Transient
    @TableField(exist = false)
    private Double vehicleWidth; //车宽
    @Transient
    @TableField(exist = false)
    private Double vehicleAxesNum; //轴数
    @Transient
    @TableField(exist = false)
    private Double vehicleWeight; //车辆总质量
    @Transient
    @TableField(exist = false)
    private Double loadingWeight;//车辆载重
    @Transient
    @TableField(exist = false)
    private String vehicleImageUrl;//车辆图片
    @Transient
    @TableField(exist = false)
    private String commTruckTypeImg; //公共车型图片
    @Transient
    @TableField(exist = false)
    private VehicleGps.TruckGpsType truckGpsType;//车辆GPS类型
    @Transient
    @TableField(exist = false)
    private String truckPosition;//车辆位置:坐标lng,lat
    @Transient
    @TableField(exist = false)
    private String truckAddress;  //车辆位置:贵阳市云岩区xxx

    @Transient
    @TableField(exist = false)
    private SourceStatus[] queryStatuses; //查询用户当前定位 用于分页距离排序
    @Transient
    @TableField(exist = false)
    private String position; //查询用户当前定位 用于分页距离排序
    @Transient
    @TableField(exist = false)
    private Double distances; //查询用户与车辆位置距离
    @Transient
    @TableField(exist = false)
    private String vehicleDetailUrl;  //车源详情链接
    @Transient
    @TableField(exist = false)
    private List<OrderAppraise> appraiseList;//前十条评价
    @Transient
    @TableField(exist = false)
    private Organize organize;
    @Transient
    @TableField(exist = false)
    private TruckVehicle vehicle;

    @Transient
    @TableField(exist = false)
    private String optTip; //操作提示
    @Transient
    @TableField(exist = false)
    private Boolean owner = false;//是否是我的
    @Transient
    @TableField(exist = false)
    private Boolean truckerCanRelease = false; //车主 是否能上线
    @Transient
    @TableField(exist = false)
    private Boolean truckerCanOffLine = false;  //车主 是否能下线
    @Transient
    @TableField(exist = false)
    private Boolean truckerCanScrap = false;//车主 是否能作废
    @Transient
    @TableField(exist = false)
    private Boolean shipperCanPush = false;//货主 是否能推送

    public static TruckSource copyRelease(TruckSource source,TruckSource param){
        if(source == null) source = new TruckSource();
        source.setIntentDeliverArea(param.getIntentDeliverArea());
        source.setIntentReceiveArea(param.getIntentReceiveArea());
        source.setIntentGoodsType(param.getIntentGoodsType());
        source.setRemarks(param.getRemarks());
        source.setSourceStatus(param.getSourceStatus());
        return source;
    }

    public Boolean getShipperCanPush() {
        return shipperCanPush;
    }

    public void setShipperCanPush(Boolean shipperCanPush) {
        this.shipperCanPush = shipperCanPush;
    }

    public String getOptTip() {
        return optTip;
    }

    public void setOptTip(String optTip) {
        this.optTip = optTip;
    }

    public Boolean getOwner() {
        return owner;
    }

    public void setOwner(Boolean owner) {
        this.owner = owner;
    }

    public Boolean getTruckerCanRelease() {
        return truckerCanRelease;
    }

    public void setTruckerCanRelease(Boolean truckerCanRelease) {
        this.truckerCanRelease = truckerCanRelease;
    }

    public Boolean getTruckerCanOffLine() {
        return truckerCanOffLine;
    }

    public void setTruckerCanOffLine(Boolean truckerCanOffLine) {
        this.truckerCanOffLine = truckerCanOffLine;
    }

    public Boolean getTruckerCanScrap() {
        return truckerCanScrap;
    }

    public void setTruckerCanScrap(Boolean truckerCanScrap) {
        this.truckerCanScrap = truckerCanScrap;
    }

    public TruckVehicle getVehicle() {
        return vehicle;
    }

    public void setVehicle(TruckVehicle vehicle) {
        this.vehicle = vehicle;
    }

    public SourceStatus[] getQueryStatuses() {
        return queryStatuses;
    }

    public void setQueryStatuses(SourceStatus[] queryStatuses) {
        this.queryStatuses = queryStatuses;
    }

    public String getTruckTypeName() {
        return truckTypeName;
    }

    public void setTruckTypeName(String truckTypeName) {
        this.truckTypeName = truckTypeName;
    }

    public Organize getOrganize() {
        return organize;
    }

    public void setOrganize(Organize organize) {
        this.organize = organize;
    }

    public List<OrderAppraise> getAppraiseList() {
        return appraiseList;
    }

    public void setAppraiseList(List<OrderAppraise> appraiseList) {
        this.appraiseList = appraiseList;
    }

    public String getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(String vehicleId) {
        this.vehicleId = vehicleId;
    }

    public String getTrackNo() {
        return trackNo;
    }

    public void setTrackNo(String trackNo) {
        this.trackNo = trackNo;
    }

    public String getCommTruckTypeId() {
        return commTruckTypeId;
    }

    public void setCommTruckTypeId(String commTruckTypeId) {
        this.commTruckTypeId = commTruckTypeId;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public SourceStatus getSourceStatus() {
        return sourceStatus;
    }

    public void setSourceStatus(SourceStatus sourceStatus) {
        this.sourceStatus = sourceStatus;
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getOrganizeId() {
        return organizeId;
    }

    public void setOrganizeId(String organizeId) {
        this.organizeId = organizeId;
    }

    public String getOrganizeName() {
        return organizeName;
    }

    public void setOrganizeName(String organizeName) {
        this.organizeName = organizeName;
    }

    public String getOrganizeLogo() {
        return organizeLogo;
    }

    public void setOrganizeLogo(String organizeLogo) {
        this.organizeLogo = organizeLogo;
    }

    public Double getOrganizeMonthlyRating() {
        return organizeMonthlyRating;
    }

    public void setOrganizeMonthlyRating(Double organizeMonthlyRating) {
        this.organizeMonthlyRating = organizeMonthlyRating;
    }

    public String getOrganizeMemberTypeName() {
        return organizeMemberTypeName;
    }

    public void setOrganizeMemberTypeName(String organizeMemberTypeName) {
        this.organizeMemberTypeName = organizeMemberTypeName;
    }

    public String getManageUserId() {
        return manageUserId;
    }

    public void setManageUserId(String manageUserId) {
        this.manageUserId = manageUserId;
    }

    public String getIntentDeliverArea() {
        return intentDeliverArea;
    }

    public void setIntentDeliverArea(String intentDeliverArea) {
        this.intentDeliverArea = intentDeliverArea;
    }

    public String getIntentReceiveArea() {
        return intentReceiveArea;
    }

    public void setIntentReceiveArea(String intentReceiveArea) {
        this.intentReceiveArea = intentReceiveArea;
    }

    public String getIntentGoodsType() {
        return intentGoodsType;
    }

    public void setIntentGoodsType(String intentGoodsType) {
        this.intentGoodsType = intentGoodsType;
    }

    public String getCommTruckTypeName() {
        return commTruckTypeName;
    }

    public void setCommTruckTypeName(String commTruckTypeName) {
        this.commTruckTypeName = commTruckTypeName;
    }

    public String getCardPlateName() {
        return cardPlateName;
    }

    public void setCardPlateName(String cardPlateName) {
        this.cardPlateName = cardPlateName;
    }

    public TruckVehicle.TruckStatus getTruckStatus() {
        return truckStatus;
    }

    public void setTruckStatus(TruckVehicle.TruckStatus truckStatus) {
        this.truckStatus = truckStatus;
    }

    public Double getVehicleLong() {
        return vehicleLong;
    }

    public void setVehicleLong(Double vehicleLong) {
        this.vehicleLong = vehicleLong;
    }

    public Double getVehicleHeight() {
        return vehicleHeight;
    }

    public void setVehicleHeight(Double vehicleHeight) {
        this.vehicleHeight = vehicleHeight;
    }

    public Double getVehicleWidth() {
        return vehicleWidth;
    }

    public void setVehicleWidth(Double vehicleWidth) {
        this.vehicleWidth = vehicleWidth;
    }

    public Double getVehicleAxesNum() {
        return vehicleAxesNum;
    }

    public void setVehicleAxesNum(Double vehicleAxesNum) {
        this.vehicleAxesNum = vehicleAxesNum;
    }

    public Double getVehicleWeight() {
        return vehicleWeight;
    }

    public void setVehicleWeight(Double vehicleWeight) {
        this.vehicleWeight = vehicleWeight;
    }

    public Double getLoadingWeight() {
        return loadingWeight;
    }

    public void setLoadingWeight(Double loadingWeight) {
        this.loadingWeight = loadingWeight;
    }

    public String getVehicleImageUrl() {
        return vehicleImageUrl;
    }

    public void setVehicleImageUrl(String vehicleImageUrl) {
        this.vehicleImageUrl = vehicleImageUrl;
    }

    public String getCommTruckTypeImg() {
        return commTruckTypeImg;
    }

    public void setCommTruckTypeImg(String commTruckTypeImg) {
        this.commTruckTypeImg = commTruckTypeImg;
    }

    public VehicleGps.TruckGpsType getTruckGpsType() {
        return truckGpsType;
    }

    public void setTruckGpsType(VehicleGps.TruckGpsType truckGpsType) {
        this.truckGpsType = truckGpsType;
    }

    public String getTruckPosition() {
        return truckPosition;
    }

    public void setTruckPosition(String truckPosition) {
        this.truckPosition = truckPosition;
    }

    public String getTruckAddress() {
        return truckAddress;
    }

    public void setTruckAddress(String truckAddress) {
        this.truckAddress = truckAddress;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public Double getDistances() {
        return distances;
    }

    public void setDistances(Double distances) {
        this.distances = distances;
    }

    public String getVehicleDetailUrl() {
        return vehicleDetailUrl;
    }

    public void setVehicleDetailUrl(String vehicleDetailUrl) {
        this.vehicleDetailUrl = vehicleDetailUrl;
    }
}
